package com.hx.learn.use.local.lib.web;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * 描述：
 *
 * @author Minghua Chen
 * @date 2020-11-26 22:30
 */
@RestController
public class App {

    @RequestMapping("/get")
    public String printSt() throws SQLException, ClassNotFoundException {
        Class.forName("com.mysql.jdbc.Driver");
        String url = "jdbc:mysql://localhost:3306/db_all";
        Connection connection =null;
        try {
            connection = DriverManager.getConnection(url, "root", "8899");
        } catch (Exception e) {
            System.out.println("出现异常");
            throw e;
        }
        System.out.println(connection);
        return "SUCCESS";
    }

}
